﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace System
{
    public sealed class DisposableAction : IDisposable
    {
        private Action m_Action;
        private bool bIsDisposed = false;

        public DisposableAction(Action action)
        {
            m_Action = action;
        }

        public void Dispose()
        {
            if (!bIsDisposed)
            {
                m_Action();
                bIsDisposed = true;
            }
        }
    }
}
